//
//  MessageRowView.swift
//  MiaoTan
//
//  Created by 于航 on 2024/9/22.
//

import SwiftUI

struct MessageRowView: View {
    var messagePreview: MessagePreview
    var body: some View {
        HStack(spacing: 15) {
            CircleAvator(photo: messagePreview.user.photo, size: 50)
            VStack(alignment: .leading, spacing: 5) {
                Text(messagePreview.user.name)
                    .font(.system(size: 20, weight: .semibold))
                Text(messagePreview.lastMessage)
                    .foregroundColor(.gray)
                    .lineLimit(1)
            }
            Spacer()
        }
        .padding(.horizontal, 15)
    }
}

#Preview {
    MessageRowView(messagePreview: MessagePreview.examples[0])
    MessageRowView(messagePreview: MessagePreview.examples[1])
}
